# Contributor: Mike Crute <mike@crute.us>
# Maintainer:  Mike Crute <mike@crute.us>
pkgname=nmon
pkgver=16m
pkgrel=0
pkgdesc="Nigel's performance Monitor for Linux"
url="http://nmon.sourceforge.net/"
arch="all"
license="BSD-3-Clause"
options="!check" # no upstream tests
makedepends="ncurses-dev"
source="
	glibc.patch

	http://sourceforge.net/projects/nmon/files/lmon$pkgver.c
	"

prepare() {
	mkdir "$builddir"
	cp lmon$pkgver.c "$builddir"/lmon.c
	default_prepare
}

build() {
	case "$CARCH" in
		ppc64le)		_BUILD_ARCH="POWER" ;;
		s390x)			_BUILD_ARCH="MAINFRAME" ;;
		arm*|aarch64)	_BUILD_ARCH="ARM" ;;
		*)				_BUILD_ARCH="X86" ;;
	esac

	echo "Building for $_BUILD_ARCH"
	cc -o nmon lmon.c -g -O3 -Wall -lncurses -lm \
		-D $_BUILD_ARCH -D JFS -D GETUSER -D LARGEMEM
}

package() {
	install -Dm0755 nmon "$pkgdir"/usr/bin/nmon
}

sha512sums="c6749baeeefbb5fa781badcf0a3b1a77792498663155b70f00ae8da751eb72ac38f1f734fd9e2eb32cb364938e366453f50e29928f247b945b684021fbde9af5  glibc.patch
391d4703f5d052fd44a3c623155028e28649ea41a88c0fe8df81c7a7dc1f845e044f25e63352c1a7ea607c76c9afb0f82ff2841c8e789d88a9f1cf3c9e035f2e  lmon16m.c"
